package com.hspedu.final_;

public class Final01 {
    public static void main(String[] args) {
        E e = new E();
        //e.TAX_RATE = 0.09;
    }
}

//1.A类不能被继承->final修饰
final class A {}

//class B extends A {}错误

//2.方法不能被子类重写->final修饰
class C {
    public final void hi() {}
}

class D extends C {
//    @Override
//    public void hi() {
//        System.out.println("重写了C类的hi()");
//    }
}

//3.属性不能被修改->final修饰
class E {
    public final double TAX_RATE = 0.08;
}

//局部变量不能被修改->final修饰
class F {
    public void cry() {
        //NUM也称为局部常量
        final double NUM = 0.01;
        //NUM = 0.9;
        System.out.println("NUM=" + NUM);
    }
}